﻿using FreeSql.DataAnnotations;
using Jumei.Common.BaseModel;
using Jumei.Model.Business.MemberManage;
using System;

namespace Jumei.Model.Business.OrdersManage
{
    /// <summary>
    /// 订单退款记录表
    /// </summary>
    [Table(Name = "or_order_refunds")]
    [Index("idx_{tablename}_01", nameof(ServiceId), false)]
    public class OrderRefundsEntity : EntityFull, ITenant
    {
        /// <summary>
        /// 租户Id
        /// </summary>
        [Column(Position = -10)]
        public long? TenantId { get; set; }

        /// <summary>
        /// 订单ID
        /// </summary>
        public long OrdersId { get; set; }

        public OrdersEntity Orders { get; set; }

        /// <summary>
        /// 接收退款用户
        /// </summary>
        public long RefundTo { get; set; }

        public MemberEntity Member { get; set; }

        /// <summary>
        /// 用户申请退款原因ID	
        /// </summary>
        public long RefundResonId { get; set; }

        /// <summary>
        /// 用户申请退款原因	
        /// </summary>
        [Column(StringLength = 255)]
        public string RefundOtherReson { get; set; }

        /// <summary>
        /// 用户退款金额	
        /// </summary>
        public decimal BackMoney { get; set; }

        /// <summary>
        /// 管理员退款流水号	
        /// </summary>
        [Column(StringLength = 255)]
        public string RefundTradeNo { get; set; }

        /// <summary>
        /// 退款备注
        /// </summary>
        [Column(StringLength = 500)]
        public string RefundRemark { get; set; }

        /// <summary>
        /// 退款时间	
        /// </summary>
        public DateTime RefundTime { get; set; }

        /// <summary>
        /// 店铺不同意拒收原因	
        /// </summary>
        [Column(StringLength = 255)]
        public string ShopRejectReason { get; set; }

        /// <summary>
        /// 退款状态
        /// </summary>
        [Column(MapType = typeof(int))]
        public RefundStatusType RefundStatus { get; set; } = 0;

        /// <summary>
        /// 售后单id
        /// </summary>
        public long ServiceId { get; set; }

        /// <summary>
        /// 售后单是否已退款
        /// </summary>
        public bool IsServiceRefund { get; set; } = false;
    }
}
